﻿using Coolzon.UI.Core.Parts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Animation;

namespace Coolzon.UI.Core.Runtime.Script.Animation
{
    public class ForeverAnimationScriptObject : AnimationScriptObject
    {
        AnimationScriptObject _animation;

        public ForeverAnimationScriptObject(object animation)
            : base(0)
        {
            _animation = (AnimationScriptObject)animation;
        }

        public override void AppendToStoryboard(Widget instance, ref double duration, Storyboard storyboard)
        {
            _animation.AppendToStoryboard(instance, ref duration, storyboard);
            storyboard.RepeatBehavior = RepeatBehavior.Forever;
        }
    }
}
